#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n; cin >> n;
	vector<int> a(n * 2), b, c;
	for (int i = 0; i < 2 * n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < 2 * n; i++) {
		if (i & 1) c.push_back(a[i]);
		else b.push_back(a[i]);
	}
	for (int i = 0; i < n; i++) {
		if (b[i] != c[i]) {
			cout << -1 << endl;
			return 0;
		}
	}
	for (int i = 0; i < n; i++) cout << b[i] << " ";
	cout << endl;
	for (int i = 0; i < n; i++) cout << c[i] << " ";
	return 0;
}